The picture explains this concept very clearly.
Basically, (putting it very simple), I usually have a...
Code: Select all
class Person {
public int Id;
public string Name;
}With his idea...
Code: Select all
class Person {
public int Id;
public string Name;
private void GetEarnings();
}http://martinfowler.com/eaaCatalog/activeRecord.html
An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data.
An object carries both data and behavior. Much of this data is persistent and needs to be stored in a database. Active Record uses the most obvious approach, putting data access logic in the domain object. This way all people know how to read and write their data to and from the database.
